package com.wc.AlgoOJ_homework.AlgoOJ_HomeWork2.H_Fibonacci数列与黄金分割;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/3/5 22:38
 * @description http://43.138.190.70:8888/p/LQ1013?tid=65e6b15c27489dab814f8d41
 * 矩阵快速幂
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt();
        if (n >= 20) n = 20;
        long[][] a = new long[][]{{0, 1}, {1, 1}};
        long[][] res = quickMin(a, n - 1);
        System.out.printf("%.8f\n", (double) (res[1][1]) / (res[0][1] + res[1][1]));
    }

    static long[][] mulMatrix(long[][] a, long[][] b) {
        int n = a.length;
        int m = a[0].length;
        int s = b[0].length;
        long[][] res = new long[n][s];

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < s; j++) {
                for (int k = 0; k < m; k++) {
                    res[i][j] += a[i][k] * b[k][j];
                }
            }
        }
        return res;
    }

    static long[][] quickMin(long[][] a, long b) {
        long[][] res = getE(a.length);

        while (b > 0) {
            if ((b & 1) == 1) res = mulMatrix(res, a);
            a = mulMatrix(a, a);
            b >>= 1;
        }
        return res;
    }

    static long[][] getE(int n) {
        long[][] res = new long[n][n];
        for (int i = 0; i < n; i++) res[i][i] = 1;
        return res;
    }
}
